package com.icinfo.cloud.provider.punish.api.controller;

import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.api.dto.TransferCaseDTO;
import com.icinfo.cloud.provider.punish.api.service.ICaseSourceInfoShareService;
import com.icinfo.framework.common.web.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 描述：获取案源信息Controller(协同移送调用)
 *
 * @author zhengqiang
 * @date 2022/8/20
 */
@RestController
@RequestMapping("/punish/api/casesource")
public class CaseSourceInfoShareController {
    @Resource
    private ICaseSourceInfoShareService caseSourceInfoShareService;

    /**
     * 【V1.4.1】描述： 查询案源移送信息
     *
     * @author: zhengqiang
     * @date: 2022/8/23
     * @param: caseSourceId
     * @return {@link Result< TransferCaseDTO>}
     **/
    @GetMapping("/getTransferCaseSourceInfo")
    public Result<TransferCaseDTO> getTransferCaseSourceInfo(@RequestParam("caseSourceId") String caseSourceId) {
        TransferCaseDTO transferCaseSourceInfo = caseSourceInfoShareService.getTransferCaseSourceInfo(caseSourceId);
        return Result.success(Constant.STRING_SUCCESS_EN, transferCaseSourceInfo);
    }

    /**
     * 【V1.4.1】描述： 保存案源移送结果
     *
     * @author: zhengqiang
     * @date: 2022/8/28
     * @param: caseSourceId
     * @return {@link Result< String>}
     **/
    @GetMapping("/saveTransferResultById")
    public Result<String> saveTransferResultById(@RequestParam("caseSourceId") String caseSourceId) {
        return caseSourceInfoShareService.saveTransferResultById(caseSourceId);
    }


}
